Produced by Araxis Merge on 2023-07-12 04:42:38 +0000. See www.araxis.com for information about Merge. This report uses XHTML and CSS2, and is best viewed with a modern standards-compliant browser. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.
| # | Location | File | Last Modified |
|---|---|---|---|
| 1 | Porto v4.0.5/Theme Files/Porto Theme/app/code/Smartwave/Dailydeals/Block | Main.php | 2018-03-14 03:42:10 +0000 |
| 2 | Porto v4.0.6/Theme Files/Porto Theme/app/code/Smartwave/Dailydeals/Block | Main.php | 2023-06-14 04:34:47 +0000 |
| Description | Between Files 1 and 2 | |
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 13 | 166 |
| Changed | 12 | 24 |
| Inserted | 0 | 0 |
| Removed | 0 | 0 |
| Whitespace | Consecutive whitespace is treated as a single space |
|---|---|
| Character case | Differences in character case are significant |
| Line endings | Differences in line endings (CR and LF characters) are ignored |
| CR/LF characters | Not shown in the comparison detail |
| Active line-pairing rules |
No regular expressions were active.
| 1 | <?php | 1 | <?php | |||
| 2 | namespace Smartwave\Dailydeals\Block; | 2 | namespace Smartwave\Dailydeals\Block; | |||
| 3 | 3 | |||||
| 4 | //use Magento\Framework\View\Element\Template; | 4 | //use Magento\Framework\View\Element\Template; | |||
| 5 | 5 | |||||
| 6 | use Magento\Catalog\Api\CategoryRepositoryInterface; | 6 | use Magento\Catalog\Api\CategoryRepositoryInterface; | |||
| 7 | 7 | |||||
| 8 | class Main extends \Magento\Catalog\Block\Product\ListProduct | 8 | class Main extends \Magento\Catalog\Block\Product\ListProduct | |||
| 9 | { | 9 | { | |||
| 10 | 10 | |||||
| 11 | 11 | |||||
| 12 | protected $productFactory; | 12 | protected $productFactory; | |||
| 13 | protected $dailydealFactory; | 13 | protected $dailydealFactory; | |||
| 14 | 14 | |||||
| 15 | protected $scopeConfig; | 15 | protected $scopeConfig; | |||
| 16 | 16 | |||||
| 17 | public function __construct( | 17 | public function __construct( | |||
| 18 | \Magento\Catalog\Block\Product\Context $context, | 18 | \Magento\Catalog\Block\Product\Context $context, | |||
| 19 | \Magento\Catalog\Model\ProductFactory $productFactory, | 19 | \Magento\Catalog\Model\ProductFactory $productFactory, | |||
| 20 | \Magento\Framework\Data\Helper\PostHelper $postDataHelper, | 20 | \Magento\Framework\Data\Helper\PostHelper $postDataHelper, | |||
| 21 | \Magento\Catalog\Model\Layer\Resolver $layerResolver, | 21 | \Magento\Catalog\Model\Layer\Resolver $layerResolver, | |||
| 22 | CategoryRepositoryInterface $categoryRepository, | 22 | CategoryRepositoryInterface $categoryRepository, | |||
| 23 | \Magento\Framework\Url\Helper\Data $urlHelper, | 23 | \Magento\Framework\Url\Helper\Data $urlHelper, | |||
| 24 | \Smartwave\Dailydeals\Model\DailydealFactory $dailydealFactory, | 24 | \Smartwave\Dailydeals\Model\DailydealFactory $dailydealFactory, | |||
| 25 | array $data = [] | 25 | array $data = [] | |||
| 26 | ) { | 26 | ) { | |||
| 27 | 27 | |||||
| 28 | $this->productFactory= $productFactory; | 28 | $this->productFactory= $productFactory; | |||
| 29 | $this->dailydealFactory=$dailydealFactory; | 29 | $this->dailydealFactory=$dailydealFactory; | |||
| 30 | 30 | |||||
| 31 | $this->scopeConfig=$context->getScopeConfig(); | 31 | $this->scopeConfig=$context->getScopeConfig(); | |||
| 32 | 32 | |||||
| 33 | return parent::__construct($context, $postDataHelper, $layerResolver, $categoryRepository, $urlHelper, $data); | 33 | return parent::__construct($context, $postDataHelper, $layerResolver, $categoryRepository, $urlHelper, $data); | |||
| 34 | } | 34 | } | |||
| 35 | 35 | |||||
| 36 | // @return Productcollection whose status is enabled | 36 | // @return Productcollection whose status is enabled | |||
| 37 | public function getDailydealEnableProduct() | 37 | public function getDailydealEnableProduct() | |||
| 38 | { | 38 | { | |||
| 39 | $collection=$this->getDailydealCollection(); | 39 | $collection=$this->getDailydealCollection(); | |||
| 40 | $collection->addFieldToSelect('*'); | 40 | $collection->addFieldToSelect('*'); | |||
| 41 | $collection->addFieldToFilter('sw_deal_enable', ['eq' => 1]); | 41 | $collection->addFieldToFilter('sw_deal_enable', ['eq' => 1]); | |||
| 42 | 42 | |||||
| 43 | return $collection; | 43 | return $collection; | |||
| 44 | } | 44 | } | |||
| 45 | 45 | |||||
| 46 | public function getDailydealCollection() | 46 | public function getDailydealCollection() | |||
| 47 | { | 47 | { | |||
| 48 | $collection=$this->dailydealFactory->create()->getCollection(); | 48 | $collection=$this->dailydealFactory->create()->getCollection(); | |||
| 49 | return $collection; | 49 | return $collection; | |||
| 50 | } | 50 | } | |||
| 51 | 51 | |||||
| 52 | // Get Product Data which is common in DailydealCollection | 52 | // Get Product Data which is common in DailydealCollection | |||
| 53 | public function getDailyDealProduct($productSku) | 53 | public function getDailyDealProduct($productSku) | |||
| 54 | { | 54 | { | |||
| 55 | $productCollection=$this->productFactory->create()->getCollection(); | 55 | $productCollection=$this->productFactory->create()->getCollection(); | |||
| 56 | $productCollection->addAttributeToSelect('*'); | 56 | $productCollection->addAttributeToSelect('*'); | |||
| 57 | $productCollection->addAttributeToFilter('sku', ['eq'=>$productSku]); | 57 | $productCollection->addAttributeToFilter('sku', ['eq'=>$productSku]); | |||
| 58 | 58 | |||||
| 59 | return $productCollection; | 59 | return $productCollection; | |||
| 60 | } | 60 | } | |||
| 61 | 61 | |||||
| 62 | //Retrun Recently dailydeal offer Collection ( duration is 2 days before expired and 2 days ago comming soon offer) | 62 | //Retrun Recently dailydeal offer Collection ( duration is 2 days before expired and 2 days ago comming soon offer) | |||
| 63 | public function recentlyDailydeal($productSku) | 63 | public function recentlyDailydeal($productSku) | |||
| 64 | { | 64 | { | |||
| 65 | 65 | |||||
| 66 | $dailydealcollection=$this->getDailydealCollection(); | 66 | $dailydealcollection=$this->getDailydealCollection(); | |||
| 67 | $dailydealcollection->addFieldToSelect('*'); | 67 | $dailydealcollection->addFieldToSelect('*'); | |||
| 68 | $dailydealcollection->addFieldToFilter('sw_product_sku', ['eq'=>$productSku]); | 68 | $dailydealcollection->addFieldToFilter('sw_product_sku', ['eq'=>$productSku]); | |||
| 69 | 69 | |||||
| 70 | if ($dailydealcollection->getSize() ==1) { | 70 | if ($dailydealcollection->getSize() ==1) { | |||
| 71 | $objectManager = \Magento\Framework\App\ObjectManager::getInstance(); | 71 | $objectManager = \Magento\Framework\App\ObjectManager::getInstance(); | |||
| 72 | $objDate = $objectManager->create('Magento\Framework\Stdlib\DateTime\DateTime'); | 72 | $objDate = $objectManager->create('Magento\Framework\Stdlib\DateTime\DateTime'); | |||
| 73 | 73 | |||||
| 74 | $curdate=strtotime($objDate->gmtDate("Y-m-d H:i:s")); | 74 | $curdate=strtotime($objDate->gmtDate("Y-m-d H:i:s")); | |||
| 75 | $Todate=strtotime($dailydealcollection->getFirstItem()->getSwDateTo()); | 75 | $Todate=strtotime($dailydealcollection->getFirstItem()->getSwDateTo()); | |||
| 76 | $fromdate=strtotime($dailydealcollection->getFirstItem()->getSwDateFrom()); | 76 | $fromdate=strtotime($dailydealcollection->getFirstItem()->getSwDateFrom()); | |||
| 77 | 77 | |||||
| 78 | // calculate two days time | 78 | // calculate two days time | |||
| 79 | $twodays_duration=172800; | 79 | $twodays_duration=172800; | |||
| 80 | 80 | |||||
| 81 | $expiredduration=$curdate-$Todate; // It returns positive value | 81 | $expiredduration=$curdate-$Todate; // It returns positive value | |||
| 82 | 82 | |||||
| 83 | $comingsoonduration=$curdate-$fromdate; // It returns Nagative value | 83 | $comingsoonduration=$curdate-$fromdate; // It returns Nagative value | |||
| 84 | 84 | |||||
| 85 | // Check datetime duration before two days and ago twodays | 85 | // Check datetime duration before two days and ago twodays | |||
| 86 | if ($expiredduration > $twodays_duration || $comingsoonduration < -$twodays_duration) { | 86 | if ($expiredduration > $twodays_duration || $comingsoonduration < -$twodays_duration) { | |||
| 87 | return false; | 87 | return false; | |||
| 88 | } else { | 88 | } else { | |||
| 89 | return true; // Return True if collection of product which are expired and comming Duration is two days | 89 | return true; // Return True if collection of product which are expired and comming Duration is two days | |||
| 90 | } | 90 | } | |||
| 91 | } else { | 91 | } else { | |||
| 92 | return false; | 92 | return false; | |||
| 93 | } | 93 | } | |||
| 94 | } | 94 | } | |||
| 95 | } | 95 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993–2019 Araxis Ltd (www.araxis.com). All rights reserved.